const express = require("express");
const { query } = require("../public/javascripts/library/conn");

const router = express.Router();

/* GET users listing. */
router.get("/getItems", async function (req, res, next) {
  let sql = "select * from product";
  let data = await query(sql);
  res.send(data);
});

router.get("/getItem", async function (req, res, next) {
  // console.log(req);
  console.log(req.query);
  let sql = `select * from product where id=${req.query.id}`;
  let data = await query(sql);
  res.send(data);
});

module.exports = router;
